<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>  
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<% 
	request.setCharacterEncoding("utf-8");	
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Insert title here</title>
<link href="css/bootstrap.min.css" rel="stylesheet" />
<link type="text/css" href="css/join.css" rel="stylesheet" />
</head>
<body>
	<table>
		<tr>
			<td>
			<div id="joinsquare">
					<img src="img/joinform01.png">
				</div>
				<div id="memberJoinForm">
					<h3 id="joinFormTitle">회원 정보 입력</h3>	
						<form id="joinForm" name="joinForm" action="joinwrite.mvc" method="post">
								<div id="memberId">
									<h5>* 아이디 :&nbsp;<input type="text"  id="userId" name="userId" style="IME-MODE: disabled" 
										size="15" onkeypress="inputIdCheck();" 
										value="${ sessionScope.member.id }"/></h5></div>
								<div id="memberId_btn">
									<input type="button" class="btn btn-success" value="중복확인"	 id="idCheck" name="idCheck"				
											onclick="overlapIdCheck(this.form);"/></div>
								<div id="memberInputPass">
									<h5>* 비밀번호 :	&nbsp;<input type="password" id="userPw" name="userPw" 
										value="${ sessionScope.member.pass }"
										size="15" onkeypress="inputPassCheck();" /></h5></div>					
								<div id="memberInputPass2">
									<h5>* 비밀번호 확인 :&nbsp;<input type="password" id="userPw1" name="userPw1"
										value="${ sessionScope.member.pass }"
										size="15" onkeypress="inputPassCheck();" /></h5></div>
								<div id="memberName">
									<h5>* 이&nbsp;&nbsp;름 :&nbsp;<input type="text" id="userName" name="userName" size="15" 
										value="${ sessionScope.member.name }" /></h5></div>
								<div id="memberPhon">
									<h5>* 휴 대 폰 :&nbsp;<input type="text" id="userPhon" name="userPhon"/></h5></div>
								<div id="memberEmail">
									<H5>* 이 메 일 :&nbsp;<input type="text" id="userEmail" name="userEmail" size="10" 
										style="IME-MODE: disabled"/></H5>
									</div>
								
								
							<input type="hidden" name="isIdCheck" value="false"/>
							
							<div id="formButton">
								<input type="reset" class="btn"  value="다시쓰기"/>
								<input type="button" id="gaip" class="btn btn-primary" value="가입하기" onclick="joinMember();"/></div>			
								<input type="hidden" id="chkresult" value=${ chkresult } />
								<input type="hidden" id="idchk" value="1" />
						</form>	
			</div>
		</td>
	</tr>
</table>
<script src="js/jquery-1.11.1.min.js"></script>
        <script>
        	// join.jsp에서 회원정보를 입력받아 joinok.jsp로 전송
        	// 즉, 모든 회원정보가 입력되었는지 확인하고
        	// 확인되면 joinok.jsp로 전송
        	
        	$("#saveMember").click(function(){ joinMember(); });
        	function joinMember() {
        		if ($("#userName").val() == "") alert("이름을 입력하세요!");
        		else if ($("#userId").val() == "") alert("아이디를 입력하세요!");
        		else if ($("#userPw").val() == "") alert("비밀번호 입력하세요!");
        		else if ($("#userPw").val() != $("#userPw1").val()) 
        						alert("비밀번호가 일치하지 않아요!");
        		else if ($("#postNum1").val() == "") alert("우편번호를 입력하세요!");
        		else if ($("#userAddr").val() == "") alert("자택주소를 입력하세요!");
        		else if ($("#userEmail").val() == "") alert("이메일을 입력하세요!");
        		else if ($("#userPhone").val() == "") alert("전화번호를 입력하세요!");
        		else {
        			$("#joinForm").submit();
        		}
        	}
        	
        	function overlapIdCheck(formObj){
        		if ($("#userId").val() == ""){ alert("아이디를 입력하세요!");
        		}
        		else{
        			alert("사용 가능한 아이디입니다.");
        		
        			var typid = $("#userId").val();
        		}
        	} 
        	
</script>
</body>
</html>